Return to doc.sitecore.com

  Cache Sizing
Prev Next

There are two major levels of caching in Sitecore:

Cache sizes can be set up either on a specific site or database definition or it can be specified in the <cacheSizes> section. The values set directly on a site or a database will always take precedence over the values set in <cacheSizes>.

Each set of caches is completely unrelated to other sets and works in its own environment with its own data.

Site-level caches are rather specific and work only in certain situations:

The <cacheSizes> section should pretty much be self-explanatory. An example is shown below.

<cacheSizes> section settings

    <cacheSizes>

      <databases>

        <master>

          <data>20MB</data> <!-- data cache size for the database -->

          <credential>2MB</credential> <!-- security data cache size for the database -->

          <path>1MB</path> <!-- file path cache used by items of the database -->

        </master>

      </databases>

      <sites>

        <shell>

          <html>2MB</html> <!-- html cache size for the site -->

          <registry>3MB</registry> <!-- registry cache size for the site -->

          <viewState>200KB</viewState> <!-- view state cache size for the site -->

          <xsl>5MB</xsl> <!-- xsl renderings cache size for the site -->

        </shell>

      </sites>

    </cacheSizes>

The valid cache names for the <databases> element are:

The valid cache names for the <sites> element are:

To set a cache size directly on a database, you must use the properties on the database object (as the database object is constructed by Sitecore.Factory using only reflection).

To set the size of the data cache on the "master" database you can use:   

<database id="master" ...>
... 
  <caches.DataCache.MaxSize>1000000</caches.DataCache.MaxSize>
</database>  

Note that the size must be specified in bytes (as the type of the MaxSize property is long).

Database caches are controlled by the CacheOptions.DisableAll setting in the <dataProviders> section of the web.config file. CacheOptions.DisableAll set to true on a dataprovider will disable database-level caches for all databases that use this dataprovider. For instance:

      <filesystem type="Sitecore.Data.DataProviders.FileSystemDataProvider, Sitecore.Kernel">

        <CacheOptions.DisableAll>true</CacheOptions.DisableAll>

      </filesystem>

Below is the list of all web.config cache settings.

Cache size of the IDTable

    <IDTable type="Sitecore.Data.$(database).$(database)IDTable, Sitecore.$(database)">

      <param desc="cacheSize">500KB</param>

    </IDTable>

<site>  cache settings

To set a cache size directly on a site, use an attribute named xxxCache where xxx is the name of the cache. For instance, to set the size of the html cache on the web site use:   

<site name="website"  ... htmlCache="10MB" />  

The size can be specified in bytes (no postfix), kilobytes (KB) or megabytes (MB). Spaces and dots are allowed in the value string, so the following is also valid:   

<site name="website" ...  htmlCache="1.024 KB" />  

 

The settings listed below define the basic cache settings. They are overridden by the settings defined in the <sites> section.

1.  Cache Duration

If the default cache duration is not sufficient, renderings can be written to perform their own caching.

2.  Publishing

Items which are updated by the publishing process are automatically removed from the item XML cache. By default /web.config is configured such that publishing clears the security and rendering caches. In this configuration frequent publication can decrease performance. It is also possible to clear the rendering cache on a scheduled basis.


Prev Next